<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="UTF-8">
    <title>Grafika</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/normalize.css" media="screen">
    <link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Roboto'>
    <link rel="stylesheet" type="text/css" href="css/stylesheet.css" media="screen">
</head>
<body>
<button id="sidebar-show" class="sidebar-show"></button>    <div id="content" class="content">
        <h1>What is Grafika?</h1>
        <p>Grafika is an advance image processing and graphics library for PHP.</p>

        <a href="https://github.com/kosinix/grafika/archive/master.zip" class="button">Download .zip</a>
        <a href="https://github.com/kosinix/grafika/" class="button">Github</a>

        <h2>Why Grafika?</h2>
        <p>Why another image manipulation lib? There are a bazillion other libs for PHP already, why reinvent the wheel? Well...</p>
        <h6>Unique Features</h6>
        <p>These are the features that makes Grafika unique from other libs:</p>
        <ul>
            <li><strong>Smart Crop</strong> - Grafika can guess the crop position based on the image content where the most important regions are preserved.</li>
            <li><strong>Animated GIF Support</strong> - It can resize animated GIFs on both GD and Imagick. On GD, Grafika uses its own GIF parser to do this.</li>
            <li><strong>5 Resize Modes</strong> - Resize is a first class citizen in Grafika. Call them directly using resizeFit, resizeFill, resizeExact, resizeExactWidth, and resizeExactHeight or use the generic resize api.</li>
            <li><strong>Image Compare</strong> - Find how similar two images are or check if they are exactly equal.</li>
            <li><strong>Advance Filters</strong> - Sobel edge-detection, diffusion and ordered dithering. More will be added in future releases.</li>
            <li><strong>Image Blending</strong> - Blend 2 images using the following modes: normal, multiply, overlay and screen.</li>
            <li><strong>Normalized API</strong> - No need to worry about the differences between GD and Imagick API, Grafika normalizes these operations for you.</li>
        </ul>
        <h6>Basic Filters</h6>
        <p>Grafika also support the basic filters commonly found in other libs:</p>
        <ul>
            <li>Blur</li>
            <li>Brightness</li>
            <li>Colorize</li>
            <li>Contrast</li>
            <li>Gamma</li>
            <li>Invert</li>
            <li>Pixelate</li>
            <li>Sharpen</li>
        </ul>
        <p>See Filters section for more info.</p>
        <h6>Drawing Objects</h6>
        <ul>
            <li>CubicBezier</li>
            <li>Ellipse</li>
            <li>Line</li>
            <li>Polygon</li>
            <li>QuadraticBezier</li>
            <li>Rectangle</li>
        </ul>
        <p>See Drawing Objects section for more info.</p>

        <h6>Easy Image Manipulation</h6>
        <p>Grafika makes it easier to do image manipulation in PHP.</p>
        <p>Consider the following code using PHP's default built-in image lib, GD. <br>It will resize a jpeg image to exactly 200x200 pixels:</p>
        <pre><code>$gd = imagecreatefromjpeg( 'path/to/jpeg/image.jpg' ); // Open jpeg file

$newImage = imagecreatetruecolor(200, 200); // Create a blank image

// Resize image to 200x200
imagecopyresampled(
    $newImage,
    $gd,
    0,
    0,
    0,
    0,
    200,
    200,
    imagesx($gd),
    imagesy($gd)
);

imagedestroy($gd); // Free up memory

imagejpeg( $newImage, 'path/to/edited.jpg', 90 ); // Save resized image with 90% quality

imagedestroy($newImage); // Free up memory
            </code></pre>

        <p>Now consider doing the same using grafika:</p>
        <pre><code>use Grafika\Grafika;

$editor = Grafika::createEditor();

$editor->open( $image, "path/to/jpeg/image.jpg" );
$editor->resizeExact( $image, 200, 200 );
$editor->save( $image, "path/to/edited.jpg", null, 90 );</code></pre>

        <p>You can even chain the api calls (think jQuery):</p>
<pre><code>use Grafika\Grafika;

Grafika::createEditor()
        ->open( $image, "path/to/jpeg/image.jpg" )
        ->resizeExact( $image, 200, 200 )
        ->save( $image, "path/to/edited.jpg", null, 90 );</code></pre>

        <p>See docs for more info.</p>


        <ul class="pager">
            <li class="next"><a href="requirements.html">Requirements</a></li>
        </ul>
    </div>
    <div id="sidebar" class="sidebar">
    <div class="scrollable">
        <ul class="menu">
            <li>Getting Started</li>
            <li>
                <ul>
                    <li><a href="index.html">What is Grafika?</a></li>
                    <li><a href="requirements.html">Requirements</a></li>
                    <li><a href="installation.html">Installation</a></li>
                    <li><a href="migration1x.html">Migration from 1.x</a></li>
                </ul>
            </li>
            <li>Examples</li>
            <li>
                <ul>
                    <li><a href="creating-editors.html">Creating Editors</a></li>
                    <li><a href="creating-images.html">Creating Images</a></li>
                    <li><a href="resizing.html">Resizing</a></li>
                    <li><a href="compare-images.html">Compare Images</a></li>
                    <li><a href="smart-crop.html">Smart Crop</a></li>
                    <li><a href="animated-gif.html">Animated GIF</a></li>
                </ul>
            </li>
            <li>Editor Functions</li>
            <li>
                <ul>
                    <li><a href="editor/apply.html">apply</a></li>
                    <li><a href="editor/blend.html">blend</a></li>
                    <li><a href="editor/compare.html">compare</a></li>
                    <li><a href="editor/crop.html">crop</a></li>
                    <li><a href="editor/draw.html">draw</a></li>
                    <li><a href="editor/equal.html">equal</a></li>
                    <li><a href="editor/fill.html">fill</a></li>
                    <li><a href="editor/flatten.html">flatten</a></li>
                    <li><a href="editor/flip.html">flip</a></li>
                    <li><a href="editor/free.html">free</a></li>
                    <li><a href="editor/isAvailable.html">isAvailable</a></li>
                    <li><a href="editor/opacity.html">opacity</a></li>
                    <li><a href="editor/open.html">open</a></li>
                    <li><a href="editor/resize.html">resize</a></li>
                    <li><a href="editor/resizeExact.html">resizeExact</a></li>
                    <li><a href="editor/resizeExactHeight.html">resizeExactHeight</a></li>
                    <li><a href="editor/resizeExactWidth.html">resizeExactWidth</a></li>
                    <li><a href="editor/resizeFill.html">resizeFill</a></li>
                    <li><a href="editor/resizeFit.html">resizeFit</a></li>
                    <li><a href="editor/rotate.html">rotate</a></li>
                    <li><a href="editor/save.html">save</a></li>
                    <li><a href="editor/text.html">text</a></li>
                </ul>
            </li>
            <li>Image Functions</li>
            <li>
                <ul>
                    <li><a href="image/blob.html">blob</a></li>
                    <li><a href="image/getCore.html">getCore</a></li>
                    <li><a href="image/getHeight.html">getHeight</a></li>
                    <li><a href="image/getImageFile.html">getImageFile</a></li>
                    <li><a href="image/getType.html">getType</a></li>
                    <li><a href="image/getWidth.html">getWidth</a></li>
                    <li><a href="image/isAnimated.html">isAnimated</a></li>
                </ul>
            </li>
            <li>Filters</li>
            <li>
                <ul>
                    <li><a href="filters/Blur.html">Blur</a></li>
                    <li><a href="filters/Brightness.html">Brightness</a></li>
                    <li><a href="filters/Colorize.html">Colorize</a></li>
                    <li><a href="filters/Contrast.html">Contrast</a></li>
                    <li><a href="filters/Dither.html">Dither</a></li>
                    <li><a href="filters/Gamma.html">Gamma</a></li>
                    <li><a href="filters/Grayscale.html">Grayscale</a></li>
                    <li><a href="filters/Invert.html">Invert</a></li>
                    <li><a href="filters/Pixelate.html">Pixelate</a></li>
                    <li><a href="filters/Sharpen.html">Sharpen</a></li>
                    <li><a href="filters/Sobel.html">Sobel</a></li>
                </ul>
            </li>
            <li>Drawing Objects</li>
            <li>
                <ul>
                    <li><a href="draw/CubicBezier.html">CubicBezier</a></li>
                    <li><a href="draw/Ellipse.html">Ellipse</a></li>
                    <li><a href="draw/Line.html">Line</a></li>
                    <li><a href="draw/Polygon.html">Polygon</a></li>
                    <li><a href="draw/QuadraticBezier.html">QuadraticBezier</a></li>
                    <li><a href="draw/Rectangle.html">Rectangle</a></li>
                </ul>
            </li>
            <li>Additional Info</li>
            <li>
                <ul>
                    <li><a href="license.html">License</a></li>
                    <li><a href="development.html">Development</a></li>
                </ul>
            </li>
        </ul>
        <p class="credit">Grafika by Kosinix - Nico Amarilla</p>
    </div>
    <button id="sidebar-x" class="sidebar-x"></button>
    <div id="handle" class="handle"></div>
</div>    <script src="js/jquery-2.2.3.min.js"></script>
    <script src="js/site.js"></script>
</body>